<div id="content">
    <?php $row_municipio = $municipio->row_array(); ?>
    <div class="container">
        <div id="main">
            <div class="entry single">
                <div class="entry-header">
                    <h2 class="title"><?php echo $row_producto['descripcion']; ?></h2>
                    <p class="meta"><?php echo $row_municipio['desc']; ?></p>
                    <div class="post-rating">
                        <?php for ($x = 0; $x < floor($row_producto['valoracion']); $x++) { ?>
                            <a href="#"><span class="on"></span></a>
                        <?php } ?>
                        <?php for ($x = 0; $x < (5 - floor($row_producto['valoracion'])); $x++) { ?>
                            <a href="#"><span class="off"></span></a>
                        <?php } ?>                                        
                        <p><?php echo lang('vote_esta_vivienda'); ?></p>
                    </div>
                </div><!-- end .entry-header -->
                <div class="entry-content">
                    <p style="color: #9C163E"><?php echo lang('detalles_de_la_vivienda'); ?>:</p>
                    <?php echo $detalle; ?>
                    <p style="color: #9C163E"><?php echo lang('el_establecimiento_dispone_de'); ?>:</p>
                    <?php echo $contenidos; ?>
                    <p style="color: #9C163E"><?php echo lang('para_descansar_tendras_lo_siguiente'); ?>:</p>
                    <?php echo $distribucion; ?>
                    <p style="color: #9C163E"><?php echo lang('ver_la_ubicacion_en_el_mapa');?></p>
                    <p>
                        <input type="hidden" name="idproducto" id="idproducto" value="<?php echo $row_producto['id']?>" />
                        <input type="hidden" name="descproducto" id="descproducto" value="<?php echo $row_producto['descripcion']?>" />
                        <input type="button" style="background-image: url('<?php echo site_url();?>/public/images/map.png'); width: 32px; height: 32px; 
                               border: 0px; margin-left: 25px; cursor: pointer; " id="enlace_mapa" title="<?php echo lang('enlace_al_mapa');?>"/>
                        &nbsp;&nbsp;<?php echo lang('enlace_al_mapa');?>
                    </p>
                    <div id="div_cargando"></div>
                    <div id="div_mapa" style="height: 450px; display: none"><!--?php echo $map['mapdiv']; ?--></div>
                    <p style="color: #9C163E"><?php echo lang('cerca_de_la_vivienda_puede_encontrar'); ?>:</p>
                    <?php echo $distancias; ?>
                </div><!-- end .entry-content -->
            </div><!-- end .entry -->
            <ul class="gallery-list clearfix">
                <?php foreach ($foto->result_array() as $clave_foto => $row_foto) { ?>
                    <li class="box" style="width: 333px">
                        <div class="entry-header">
                            <div class="zoom">
                                <a href="<?php echo base_url() . $ruta_foto . "/" . $row_foto['url']; ?>" class="multi_images" rel="gallery-images" title="<?php echo $row_foto['desc']; ?>">
                                    <img src="<?php echo base_url() . $ruta_foto . "/" . $row_foto['url']; ?>" alt="<?php echo $row_foto['desc']; ?>" class="gallery-image" width="310">
                                </a>
                            </div>
                            <h6><?php echo $row_foto['desc']; ?></h6>
                        </div><!-- end .entry-header -->
                    </li>
                <?php } ?>
            </ul>

            <div class="author-bio">
                <img src="<?php echo site_url(); ?>/public/images/llaves.png" width="100" height="100" alt="<?php echo lang('propietario'); ?>" class="avatar"/>
                <h4><?php echo lang('sobre_el_propietario') . ": " . $row_usuario['first_name']; ?></h4>
                <p><?php echo lang('informacion_del_usuario'); ?></p>
                <div style="float: right; width: 520px;">
                    <ul class="columnas2">
                        <li><?php echo lang('valoracion_de_los_inquilinos') . " " . ($row_usuario['valoracion'] != null ? $row_usuario['valoracion'] : "-"); ?></li>
                        <?php if (isset($direcciones[0])) { ?>
                            <li><a href="<?php echo site_url('busqueda/ver/' . $direcciones[0][0]); ?>"><?php echo $direcciones[0][1]; ?></a></li>
                        <?php } else { ?><li>&nbsp;</li><?php } ?>
                        <li><?php echo lang('enviar_un_mensaje'); ?></li>
                        <?php if (isset($direcciones[1])) { ?>
                            <li><a href="<?php echo site_url('busqueda/ver/' . $direcciones[1][0]); ?>"><?php echo $direcciones[1][1]; ?></a></li>
                        <?php } else { ?><li>&nbsp;</li><?php } ?>
                        <?php if (isset($direcciones[2])) { ?>
                            <li><a href="<?php echo site_url('busqueda/ver/' . $direcciones[2][0]); ?>"><?php echo $direcciones[2][1]; ?></a></li>
                        <?php } else { ?><li>&nbsp;</li><?php } ?>
                        <li>&nbsp;</li>
                        <?php if (isset($direcciones[3])) { ?>
                            <li><a href="<?php echo site_url('busqueda/ver/' . $direcciones[3][0]); ?>"><?php echo $direcciones[3][1]; ?></a></li>
                        <?php } else { ?><li>&nbsp;</li><?php } ?>
                    </ul>
                </div>
            </div>
            <div id="comments">
                <div class="box-header">
                    <div class="align-left">
                        <span class="comments-count">
                            <em>&nbsp;&nbsp;<?php echo ($comentario->num_rows() > 99 ? $comentario->num_rows() : $comentario->num_rows() . "&nbsp;"); ?></em>
                        </span> 
                        <h6><?php echo lang('comentarios'); ?></h6>
                    </div>
                </div>
                <ol class="comments-list">
                    <?php if ($comentario->num_rows() > 0) { ?>
                        <?php foreach ($comentario->result_array() as $key => $value) { ?>
                            <li class="comment first">
                                <div class="comment-avatar">
                                    <img src="<?php echo site_url('public/images/avatar.png'); ?>" width="60" height="60" alt="Gravatar" class="avatar" />
                                </div><!-- .comment-avatar -->

                                <div class="comment-body">
                                    <div class="comment-meta">
                                        <a href="#">John Doe</a>, <span class="date"><?php echo $value['com_feccre']; ?></span>
                                    </div><!-- .comment-meta -->

                                    <p><?php echo $value['com_cuerpo']; ?></p>
                                    <!--ul class="comment-links">
                                        <li><a href="#">Send to a Friend</a> <span class="separator">|</span></li>
                                        <li><a href="#">Share this Comment</a> <span class="separator">|</span></li>
                                        <li><a href="#">Reply</a></li>
                                    </ul--><!-- .comment-links -->
                                </div><!-- .comment-body -->
                            </li><!-- .comment -->
                        <?php } ?>
                    <?php } else { ?>
                        <br/><span><?php echo lang('mensaje_ningun_comentario'); ?></span>
                    <?php } ?>
                </ol>

            </div><!-- #comments -->

            <ul class="pagination">
                <li class="prev"><a href="#">Prev</a></li>
                <li><a href="#">1</a></li>
                <li class="active"><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li class="next"><a href="#">Next</a></li>
            </ul>

            <?php if ($this->settings->get('habilitar_comentarios') == 'S') { ?>
                <div id="respond" class="box">
                    <div class="box-header">
                        <h6 class="align-left"><?php echo lang('dejanos_un') . " "; ?><span><?php echo lang('comentario'); ?></span></h6>
                        <p class="align-right">
                            <strong><a href="#"><?php echo lang('logueate_para_dejar_un_comentario'); ?></a></strong>
                        </p>
                    </div>

                    <form method="post" action="" id="comment-form" class="form clearfix">
                        <div class="input_block">
                            <p>
                                <label for="name"><?php echo lang('nombre') . " "; ?><span>(<?php echo lang('obligatorio'); ?>)</span></label>
                                <input type="text" name="name" id="name" class="input" value="">
                            </p>

                            <p>
                                <label for="email"><?php echo lang('email') . " "; ?><span>(<?php echo lang('obligatorio'); ?>)</span></label>
                                <input type="text" name="email" id="email" class="input" value="">
                            </p>

                            <p>
                                <label for="website"><?php echo lang('pagina_web') . " "; ?><span>(<?php echo lang('opcional'); ?>)</span></label>
                                <input type="text" name="website" id="website" class="input" value="">
                            </p>
                        </div>

                        <div class="textarea_block">
                            <p>
                                <label for="comment"><?php echo lang('comentarios'); ?></label>
                                <textarea id="comment" rows="10" cols="45" class="input"></textarea>
                            </p>

                            <p>
                                <input type="submit" name="submit" value="<?php echo lang('enviar'); ?>" class="submit" />
                            </p>
                        </div>
                    </form>
                </div><!-- end #respond -->
            <?php } ?>
        </div><!-- end #main -->
        <div id="sidebar">
            <?php if ($ses['p_datefrom'] != '' && $ses['p_dateto'] != '') { ?>
                <div id="recent-tabs" class="box" style="margin-top: 20px">
                    <div class="box-header">
                        <ul class="nav">
                            <li><a class="current" href="#recent-tabs-posts"><?php echo lang('importe'); ?></a></li>
                        </ul>
                    </div><!-- end .box-header -->
                    <div class="list-wrap">
                        <ul id="recent-tabs-posts">
                            <li style="border: 2px solid #b70e4f;">
                                <?php $dias = $this->general->restar_fechas($ses['p_datefrom'], $ses['p_dateto']); ?>
                                <?php
                                echo lang('periodo') . " " . $ses['p_datefrom'] . " - " . $ses['p_dateto'] .
                                " (" . $dias . " " . ($dias > 1 ? lang('noches') : lang('noche')) . ")";
                                ?>
                                <p class="meta" style="text-align: right; "><?php echo lang('total') . ": " . $suma_tarifa . " €"; ?></p>
                            </li>

                            <?php if ($row_producto['importe_fianza'] > 0) { ?>
                                <li>
                                    <?php echo lang('importe_para_la_fianza'); ?>
                                    <?php
                                    echo $row_producto['importe_fianza'] . "%";
                                    ?>
                                    <?php $fianza = $suma_tarifa * ($row_producto['pro_impfianza'] / 100); ?>
                                    <p class="meta" style="text-align: right"><?php echo $fianza . " €"; ?></p>
                                </li>
                            <?php } ?>

                            <?php if ($row_producto['importe_reserva'] > 0) { ?>
                                <li>
                                    <?php echo lang('importe_para_la_reserva'); ?>
                                    <?php
                                    $reserva = $row_producto['importe_reserva'];
                                    ?>
                                    <p class="meta" style="text-align: right"><?php echo $reserva . " €"; ?></p>
                                </li>
                            <?php } ?>

                            <?php if ($row_producto['importe_limpieza'] > 0) { ?>
                                <li>
                                    <?php echo lang('importe_para_la_limpieza'); ?>
                                    <p class="meta" style="text-align: right"><?php echo $row_producto['importe_limpieza'] . " €"; ?></p>
                                </li>
                            <?php } ?>

                            <li>
                                <p class="meta">
                                    <a href="<?php echo site_url('front/reserva/reservar/' . $row_producto['id']) ?>">
                                        <div class="fbutton">
                                            <div>
                                                <span class="reservar" style="padding-left: 20px;"><?php echo lang('reservar'); ?></span>
                                            </div>
                                        </div>
                                    </a>
                                </p>
                            </li>

                        </ul><!-- end #recent-tabs-posts-->

                    </div><!-- end .list-wrap -->
                </div><!-- end #recent-tabs -->                
            <?php } ?>
            <div id="recent-tabs2" class="box" style="margin-top: 20px">
                <div class="box-header">
                    <ul class="nav">
                        <li><a class="current" href="#recent-tabs-posts"><?php echo lang('cambiar_fechas'); ?></a></li>
                    </ul>
                </div><!-- end .box-header -->
                <div class="list-wrap">
                    <form name="form" action="<?php echo site_url('front/reserva/cambiar_datos_reserva') ?>" method="post">
                        <input type="hidden" name="p_producto" value="<?php echo $row_producto['id'];?>"/>
                        <ul id="recent-tabs-posts">
                            <li>
                                <?php echo lang('fecha_desde') . ": "; ?><input type="text" value="<?php echo $ses['p_datefrom']?>" id="datefrom" name="datefrom" size="9"/>
                                <br/><br/>
                                <?php echo lang('fecha_hasta') . ": "; ?><input type="text" value="<?php echo $ses['p_dateto']?>" id="dateto" name="dateto" size="9"/>
                            </li>
                            <li>
                                <?php echo lang('personas') . ": "; ?>
                                <select id="p_personas" name="p_personas">
                                    <option value="" <?php if($ses['p_personas'] == '') echo "selected";?>><?php echo lang('sin_seleccion');?></option>
                                    <option value="1" <?php if($ses['p_personas'] == 1) echo "selected";?>>1</option>
                                    <option value="2" <?php if($ses['p_personas'] == 2) echo "selected";?>>2</option>
                                    <option value="3" <?php if($ses['p_personas'] == 3) echo "selected";?>>3</option>
                                    <option value="4" <?php if($ses['p_personas'] == 4) echo "selected";?>>4</option>
                                    <option value="5" <?php if($ses['p_personas'] == 5) echo "selected";?>>5</option>
                                    <option value="6" <?php if($ses['p_personas'] == 6) echo "selected";?>>6</option>
                                    <option value="7" <?php if($ses['p_personas'] == 7) echo "selected";?>>7</option>
                                    <option value="8" <?php if($ses['p_personas'] == 8) echo "selected";?>>8</option>
                                    <option value="9" <?php if($ses['p_personas'] == 9) echo "selected";?>>9</option>
                                    <option value="10" <?php if($ses['p_personas'] == 10) echo "selected";?>>10</option>
                                </select>
                            </li>
                            <li style="padding: 11px 10px;">
                                <div class="botonContenedor">
                                    <input type="submit" class="boton buscar" value="Cambiar"/>
                                </div>
                            </li>
                        </ul><!-- end #recent-tabs-posts-->
                    </form>
                    <div style="height: 5px"></div>
                </div><!-- end .list-wrap -->
            </div><!-- end #recent-tabs -->
        </div><!-- end #sidebar -->

        <div class="clear"></div>

    </div><!-- end .container -->
</div><!-- end #content -->